package com.yc.damai.controller;

import com.yc.damai.biz.IDmOrdersService;
import com.yc.damai.entity.DmOrders;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 大麦商城-订单表-73 前端控制器
 * </p>
 *
 * @author ly
 * @since 2024-09-23
 */
@RestController
@RequestMapping("dmOrders")
public class DmOrdersController {

    @Autowired
    IDmOrdersService ordersService;

    @RabbitListener(queuesToDeclare = @Queue("promotionQueue"))
    public void addPromotionOrder(DmOrders  orders){
        try{
            ordersService.createPromotionOrder(orders);
        } catch (Exception e){
            // TODO 发消息(邮件)给管理员
            e.printStackTrace();
        }
    }


}
